package cn.taoticket.service;

import cn.taoticket.pojo.TaoticketSchedulerSeat;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import cn.taoticket.mapper.TaoticketSchedulerSeatPriceMapper;
import cn.taoticket.pojo.TaoticketSchedulerSeatPrice;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
@RestController
public class RestTaoticketSchedulerSeatPriceService {

    @Resource
     private TaoticketSchedulerSeatPriceMapper taoticketSchedulerSeatPriceMapper;

    /**
     * 通过id获取座位价格
     * @param id
     * @return
     * @throws Exception
     */
     @RequestMapping(value = "/getTaoticketSchedulerSeatPriceById",method = RequestMethod.POST)
     public TaoticketSchedulerSeatPrice getTaoticketSchedulerSeatPriceById(@RequestParam("id") Long id)throws Exception{
        return taoticketSchedulerSeatPriceMapper.getTaoticketSchedulerSeatPriceById(id);
     }

     @RequestMapping(value = "/getTaoticketSchedulerSeatPriceListByMap",method = RequestMethod.POST)
     public List<TaoticketSchedulerSeatPrice>	getTaoticketSchedulerSeatPriceListByMap(@RequestParam Map<String,Object> param)throws Exception{
        return taoticketSchedulerSeatPriceMapper.getTaoticketSchedulerSeatPriceListByMap(param);
     }

     @RequestMapping(value = "/getTaoticketSchedulerSeatPriceCountByMap",method = RequestMethod.POST)
     public Integer getTaoticketSchedulerSeatPriceCountByMap(@RequestParam Map<String,Object> param)throws Exception{
        return taoticketSchedulerSeatPriceMapper.getTaoticketSchedulerSeatPriceCountByMap(param);
     }

     @RequestMapping(value = "/qdtxAddTaoticketSchedulerSeatPrice",method = RequestMethod.POST)
     public Integer qdtxAddTaoticketSchedulerSeatPrice(@RequestBody TaoticketSchedulerSeatPrice taoticketSchedulerSeatPrice)throws Exception{
        taoticketSchedulerSeatPrice.setCreatedTime(new Date());
        return taoticketSchedulerSeatPriceMapper.insertTaoticketSchedulerSeatPrice(taoticketSchedulerSeatPrice);
     }

     @RequestMapping(value = "/qdtxModifyTaoticketSchedulerSeatPrice",method = RequestMethod.POST)
     public Integer qdtxModifyTaoticketSchedulerSeatPrice(@RequestBody TaoticketSchedulerSeatPrice taoticketSchedulerSeatPrice)throws Exception{
        taoticketSchedulerSeatPrice.setUpdatedTime(new Date());
        return taoticketSchedulerSeatPriceMapper.updateTaoticketSchedulerSeatPrice(taoticketSchedulerSeatPrice);
     }
    @RequestMapping(value = "/getTaoticketSchedulerSeatPriceByScheduleIdAndArea", method = RequestMethod.POST)
    public TaoticketSchedulerSeatPrice getTaoticketSchedulerSeatPriceByScheduleIdAndArea(@RequestParam("scheduleId") Long scheduleId,
                                                                                    @RequestParam("areaLevel") Integer areaLevel) throws Exception{
        return taoticketSchedulerSeatPriceMapper.getTaoticketSchedulerSeatPriceByScheduleIdAndArea(scheduleId,areaLevel);
    }
}
